home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
monitory
/
amyload
/
amyload.c
< prev
next >
Wrap
C/C++ Source or Header
|
1987-11-15
|
2KB
|
99 lines
#include <intuition/intuition.h>
#include <devices/load.h>
#include "intuidef.h"
#include "execdef.h"
#include "windownode.h"
#include <exec/proto.h>
#include <intuition/proto.h>
#include "Cleanup.proto"
#include "Init.proto"
#include "NewData.proto"
#include "NewWindowSize.proto"
#include "RedrawWindow.proto"
#include "CloseLoadWindow.proto"
#include "FindWindowNode.proto"
#include "PrintRecordTypes.proto"
#define SIGQUIT 12
struct Library *GfxBase;
struct IntuitionBase *IntuitionBase;
loadrequest *loadRequest;
MsgPort *loadPort;
MsgPort *windowPort;
MinList windowList;
void
_main(argp)
char *argp;
{
IntuiMessage *msg;
Window *message_window;
unsigned long message_class;
unsigned short message_code;
long signals, window_signal_mask, load_signal_mask, combined_signal_mask;
long quit_signal_mask;
long errno;
if (errno = Init(argp))
{
Cleanup();
exit(errno);
}
quit_signal_mask = 1 << SIGQUIT;
window_signal_mask = 1 << windowPort->mp_SigBit;
load_signal_mask = 1 << loadPort->mp_SigBit;
combined_signal_mask = quit_signal_mask | window_signal_mask | load_signal_mask;
loadRequest->lr_node.io_Command = CMD_READ;
SendIO(&loadRequest->lr_node);
while(windowList.mlh_TailPred != (MinNode *)&windowList)
{
signals = Wait(combined_signal_mask);
if (signals & window_signal_mask)
{
while (msg = (struct IntuiMessage *)GetMsg(windowPort))
{
message_window = msg->IDCMPWindow;
message_class = msg->Class;
message_code = msg->Code;
ReplyMsg(msg);
switch(message_class)
{
case MOUSEBUTTONS:
if (msg->Code == MENUDOWN)
PrintRecordTypes(message_window);
break;
case CLOSEWINDOW:
CloseLoadWindow(FindWindowNode(message_window));
break;
case NEWSIZE:
if (!NewWindowSize(message_window))
goto bug_out;
break;
case REFRESHWINDOW:
BeginRefresh(message_window);
RedrawWindow(message_window);
EndRefresh(message_window, TRUE);
break;
}
}
}
if (signals & load_signal_mask)
{
(void)GetMsg(loadPort);
NewData(&loadRequest->lr_load);
SendIO(&loadRequest->lr_node);
}
if (signals & quit_signal_mask)
break;
}
bug_out:
AbortIO(&loadRequest->lr_node);
Cleanup();
}